<template>
    <div>
      <el-container style="height: 500px; border: 1px solid #eee">


        <!--侧边栏 -->
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
          <el-menu >
            <el-menu
              class="el-menu-vertical-demo"
              @open="handleOpen"
              @close="handleClose"
              background-color="#545c64"
              text-color="#fff"
              :router=true
              active-text-color="#ffd04b">
              <el-menu-item index="/index/student">
                <i class="el-icon-menu"></i>
                <span slot="title">学生信息</span>
              </el-menu-item>
              <el-menu-item index="/index/teacher">
                <i class="el-icon-document"></i>
                <span slot="title">教师信息</span>
              </el-menu-item>
              <el-menu-item index="3">
                <i class="el-icon-setting"></i>
                <span slot="title">导航四</span>
              </el-menu-item>
            </el-menu>
          </el-menu>
        </el-aside>

        <el-container>
          <!-- 头部内容-->
          <el-header style="text-align: right; font-size: 12px">
            <el-dropdown>
              <i class="el-icon-setting" style="margin-right: 15px"></i>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>查看</el-dropdown-item>
                <el-dropdown-item>新增</el-dropdown-item>
                <el-dropdown-item>删除</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
            <span>李宇春</span>
          </el-header>

          <!-- 加载页面主体-->
          <el-main>
            <!-- 加载子页面-->
            <!--<el-calendar v-model="value">-->
            <!--</el-calendar>-->
              <router-view></router-view>
          </el-main>
        </el-container>
      </el-container>
    </div>
</template>

<script>
  export default {
    data() {
      const item = {
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      };
      return {
        tableData: Array(20).fill(item),
        value: new Date()
      }
    },
    methods:{
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },

      go:function (url) {
        this.$router.push(url)
      }

    },
    mounted(){
      this.$axios.get("/user/validateLogin").then(res=>{
          if (res.data.code==0){
            alert(res.data.msg);
            this.$router.push("/")
          }
      })
    }
  };
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }
</style>
